package com.humanmonth.home.component.page.htree.remote
{
	import com.humanmonth.home.component.page.htree.MyLine;
	import com.humanmonth.home.component.page.htree.NodeAs;
	import com.humanmonth.home.component.page.htree.layout.Layout;
	import com.humanmonth.home.component.page.htree.layout.VerticalLayout;
	
	public class XmlToTree
	{
		private var xml:XML;
		public function XmlToTree(xml:XML)
		{
			this.xml=xml;
		}
		
		private function decodeNode():void{
			for each(var node:XML in xml.nodes.node){
				new NodeAs(node.x,node.y,node.order,node.name,node.id);
			}
		}
		
		private function decodeLines():void{
			for each(var line:XML in xml.lines.line){
				new MyLine(line.start,line.end);
			}
		}
		
		/**
		 * 初始化 
		 */
		public function myInit():void{
			this.decodeNode();
			this.decodeLines();
			Layout.currentLayout=new VerticalLayout();
			Layout.currentLayout.layout();
			Layout.isVertical=true;
		}

	}
}